package com.afalon.cloud.contracts.competition;

import java.net.URI;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

@PersistenceCapable
@XmlRootElement(name = "frame")
@XmlAccessorType(XmlAccessType.NONE)
public class Frame {

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key frameKey;
	
	@XmlElement(name="matchid")
	@Persistent
	private String matchId;
	
	@XmlElement(name="sequence")
	@Persistent
	private Integer sequence;
	
	@XmlElement(name="winnerid")
	@Persistent
	private String winnerId;
	
	@XmlElement(name="frameuri")
	public URI frameUri;
	
	public Frame() 
	{
		
	}

	public Key getFrameKey() {
		return frameKey;
	}
	
	@XmlElement(name="frameid")
	public String getFrameId() {
		return KeyFactory.keyToString(this.getFrameKey());
	}

	public String getMatchId() {
		return matchId;
	}

	public void setMatchId(String matchId) {
		this.matchId = matchId;
	}

	public Integer getSequence() {
		return sequence;
	}

	public void setSequence(Integer sequence) {
		this.sequence = sequence;
	}

	public String getWinnerId() {
		return winnerId;
	}

	public void setWinnerId(String winnerId) {
		this.winnerId = winnerId;
	}

}
